﻿package mortal.game.net.command.skill
{
    import Framework.MQ.*;
    import Message.Command.*;
    import Message.Public.*;
    import mortal.game.cache.*;
    import mortal.game.events.*;
    import mortal.game.mvc.*;
    import mortal.game.net.broadCast.*;
    import mortal.mvc.core.*;

    public class SkillListCommand extends BroadCastCall
    {

        public function SkillListCommand(param1:Object)
        {
            super(param1);
            return;
        }// end function

        override public function call(param1:MessageBlock) : void
        {
            var _loc_2:SSkillMsg = null;
            var _loc_3:SSkillsUpdate = null;
            switch(param1.messageHead.command)
            {
                case EGateCommand._ECmdGateSkill:
                {
                    _loc_2 = param1.messageBase as SSkillMsg;
                    Cache.instance.skill.initSkillList(_loc_2.skills);
                    NetDispatcher.dispatchCmd(ServerCommand.SkillListUpdate, null);
                    NetDispatcher.dispatchCmd(ServerCommand.BestSkillUpdate, null);
                    break;
                }
                case EGateCommand._ECmdGateSkillsUpdate:
                {
                    _loc_3 = param1.messageBase as SSkillsUpdate;
                    if (_loc_3.op == EUpdateType._EUpdateTypeAdd)
                    {
                        Cache.instance.skill.initExSkillList(_loc_3.skills);
                        NetDispatcher.dispatchCmd(ServerCommand.SkillExListUpdate, _loc_3.skills.length);
                        NetDispatcher.dispatchCmd(ServerCommand.SkillExListCdUpdate, null);
                        NetDispatcher.dispatchCmd(ServerCommand.ExSkillShortcutBarDataUpdate, null);
                    }
                    else
                    {
                        Dispatcher.dispatchEvent(new DataEvent(EventName.ShortcutBarShowHide, true));
                    }
                    break;
                }
                default:
                {
                    break;
                }
            }
            return;
        }// end function

    }
}
